import Vue from 'vue'
import VueRouter from 'vue-router'

Vue.use(VueRouter)

const routes = [
  {
    path: "/",
    name: "login",
    component: () => import("../views/login.vue")
  },
  {
    path: "/register",
    name: "register",
    component: () => import("../views/register/index.vue")
  },
  {
    path: '/forumHome',
    name: "forumHome",
   
    component: () => import("../views/forumHome/ForumHome"),
    children: [
      {
        path: "/theme_list/:id?",
        name: "theme_list",
        component: () => import("../views/forumHome/theme_list.vue")
      },
       {
        path: '/search/:message',
        name: 'search',
        component: () => import("../views/search_center/index"),
      }
    ],
     redirect: "/theme_list",
  },
  {
    path: '/post/:id',
    name: "post",
    component:()=>import("../views/Post/index")
  },
  {
    path: '/userHome/:id?',
    name: "userHome",
    component: () => import("../views/userHome/index")
  },
  {
    path: '/check',
    name: "check",
    component: () => import("../views/check/index"),

  },
 
]

const router = new VueRouter({
  routes
})


const originalPush = VueRouter.prototype.push
VueRouter.prototype.push = function push(location) {
    return originalPush.call(this, location).catch(err => err)
}



export default router




